/* eslint-disable class-methods-use-this */
import _axios, { get, put, _delete } from '@/lin/plugin/axios'

// 我们通过 class 这样的语法糖使模型这个概念更加具象化，其优点：耦合性低、可维护性。
class WarehouseInput {
  // constructor() {}

  // 类中的方法可以代表一个用户行为
  async createWarehousePurchaseList(data) {
    return _axios({
      method: 'post',
      url: 'warehouseInput/purchaseList',
      data,
    })
  }

  async createWarehouseInputList(id, handlerId) {
    const res = await put(`warehouseInput/inputList/${id}/${handlerId}`)
    return res
  }

  async createWarehouseReturnList(id, handlerId) {
    const res = await put(`warehouseInput/returnList/${id}/${handlerId}`)
    return res
  }

  async getPurchaseList() {
    const res = await get('warehouseInput/purchase/list')
    return res
  }

  async getInputList() {
    const res = await get('warehouseInput/input/list')
    return res
  }

  async getPurchaseDetails(id) {
    const res = await get(`warehouseInput/purchase/details/${id}`)
    return res
  }

  async getInputDetails(id) {
    const res = await get(`warehouseInput/input/details/${id}`)
    return res
  }
}

export default new WarehouseInput()
